<template>
  <div id="test">
    <div v-html="html"></div>
  </div>
</template>

<script>
  import ejs from 'ejs'
  import axiosUtils from '@/api/env'
  import { camelCaseName } from '@/components/common/utils'

  export default {
    name: 'test',
    data () {
      let people = ['geddy', 'neil', 'alex']
      let html = ''
      let datas = { people, html }
      return datas
    },
    computed: {},
    methods: {},
    created () {
    },
    mounted () {
      // ejs.renderFile('static/template/domain', , {}, (err, str) => {
      //   // str => 输出绘制后的 HTML 字符串
      //   this.html = str
      // })
      const customAxios = axiosUtils._initAxios()
      customAxios({
        url: 'http://localhost:827/static/template/domain.ejs?time=' + Date.now(),
        method: 'get'
      }).then((res) => {
        let tem = res.data
        let html = ejs.render(tem, { columns: [{ type: 'int', name: 'id' }, { type: 'int', name: 'id' }, { type: 'int', name: 'id' }], camelCaseName: camelCaseName })
        console.log('resHtml+++resHtml', html)
        this.html = html
      })
      // ejs
    },
    components: {}
  }
</script>

<style scoped>

</style>